package com.hlhj.funlike_businessqzxd.moudle;

import android.content.Context;

import com.example.mymvp.mvp.BaseModule;
import com.hlhj.funlike_businessqzxd.api.Apis;
import com.hlhj.funlike_businessqzxd.api.BaseObser;
import com.hlhj.funlike_businessqzxd.bean.OrderListBean;
import com.lzy.okgo.model.Response;

import java.util.List;

public class CompletedFragmentMoudle implements BaseModule{
    public interface getOrderLsit{
        void loadOrderList(List<OrderListBean.DataBeanX.DataBean> dataBeans);
    }

    public getOrderLsit listener;

    public void setListener(getOrderLsit listener) {
        this.listener = listener;
    }

    public void LoadOrderList(Context context, int status, int p, int num){
        Apis.INSTANCE.OrderList(status,p,num)
                .subscribe(new BaseObser<Response<OrderListBean>>(context) {
                    @Override
                    public void httpSuccess(Response<OrderListBean> orderListBeanResponse) {
                        if (listener!=null){
                            listener.loadOrderList(orderListBeanResponse.body().getData().getData());
                        }
                    }
                });
    }
}
